(function (aopc) {
    aopc.addExpandPage(818, function (get) {
        const Common = get('UtilsCommon', 'Common');
        return {
            expandInit() {
                this.dialog_meeting_service = this.getProperty('dialog_meeting_service');

                const serviceType = this.getProperty('ServiceType');
                const [r1, r2] = serviceType.properties;
                r1.properties.forEach(p => {
                    p.eventActionName = 'setServiceType';
                    p.style.border = "4rem solid #ECF6FF"
                });
                r2.properties.forEach(p => {
                    p.eventActionName = 'setServiceType';
                    p.style.border = "4rem solid #ECF6FF"
                });
                this.serviceType = serviceType;
                serviceType.getValue = () => {
                    const vs = [];
                    r1.properties.forEach(p => {
                        if (p.selectValue) vs.push(p.selectValue);
                    });
                    r2.properties.forEach(p => {
                        if (p.selectValue) vs.push(p.selectValue);
                    });
                    return vs.join(",");
                };
                serviceType.setValue = () => {
                    r1.properties.forEach(p => {
                        this.setEmptyValue(p);
                    });
                    r2.properties.forEach(p => {
                        this.setEmptyValue(p);
                    });
                };
            },
            setEmptyValue(p) {
                if (p.selectValue) {
                    p.selectValue = '';

                    const p1 = p.properties[1];

                    p.style.border = "4rem solid #ECF6FF";
                    p1.spanStyle.color = "#2a2a2a";

                    p.refresh();
                    p1.refresh();
                }
            },
            show() {
                this.dialog_meeting_service.setIsVisible(true);
            },
            expandSetEntityData({ entityData }) {
                entityData.MeetingId = this.pageData.MeetingId;
                if (Common.isNullOrEmpty(entityData.ServiceType) && Common.isNullOrEmpty(entityData.Content)) {
                    this.alert('请选择服务类型或输入您的需求！')
                    return false;
                }
                return entityData;
            },
            setSelfHide({ property, e }) {
                const ele = property.getElement();
                if (ele === e.target) property.setIsVisible(false);
            },
            setServiceType({ property }) {
                const p1 = property.properties[1];
                property.selectValue = property.selectValue ? '' : p1.text;
                if (property.selectValue) {
                    if (this.theme === 'red') {
                        property.style.border = "4rem solid #E40404";
                        p1.spanStyle.color = "#E40404";
                    }
                    else {
                        property.style.border = "4rem solid #2C7AD3";
                        p1.spanStyle.color = "#2C7AD3";
                    }
                }
                else {
                    property.style.border = "4rem solid #ECF6FF";
                    p1.spanStyle.color = "#2a2a2a";
                }
                property.refresh();
                p1.refresh();
            },
            successCallback() {
                const pageAxis = this.props.getPageAxis();
                this.alertSuccess('发送成功', () => {
                    this.dialog_meeting_service.setIsVisible(false);
                    pageAxis.webSocket.send('sendService');
                });
            }
        }
    });
})(window.aopc);